package com.springboot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.springboot.bean.Student;
import com.springboot.service.StudentService;

@RestController
public class TestController {

    @Autowired
    private StudentService studentService;

    @RequestMapping(value = "/querystudent", method = RequestMethod.GET)
    public Student queryStudentBySno(String sno) {
        return this.studentService.queryStudentBySno(sno);
    }

    @GetMapping("/update-student-info")
    public String updateStudentInfoBySno(@RequestParam("sno") String sno) {
        Student stu = new Student();
        stu.setSno(sno);
        stu.setName("xiaoming");
        stu.setSex("F");
        this.studentService.update(stu);
        return "update success";
    }

}
